package com.zy.mobile.message.push.bio;

import java.net.ServerSocket;
import java.net.Socket;

/**
 * 阻塞式io服务器 
 * @author zhangyi
 *
 */
public class BioTimeServer {
	
	public static void main(String[] args) {
		int port = 8080;
		if(args!=null&args.length>0){
			try {
				port = Integer.valueOf(args[0]);
			} catch (Exception e) {
				// TODO: handle exception
			}
		}
		ServerSocket server = null;
		try {
			server = new ServerSocket(port);
			System.out.println("the time server is start in port : "+port);
			Socket socket = null;
			while(true){
				socket = server.accept();
				new Thread(new BioTimeServerHandler(socket)).start();
			}
		} catch (Exception e) {
			// TODO: handle exception
		}
	}
}
